package com.util;

import java.util.ArrayList;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.dao.CustomerInfoDAO;
import com.entity.PageModel;

public class PublicToolShowCustomerInfoList {

	public static void searchCustomerInfo(HttpServletRequest request,
			HttpServletResponse response, String cp, String key) {

		CustomerInfoDAO cdao = new CustomerInfoDAO();

		int sumCount = cdao.getSumSearchCustomerCount(key);

		PageModel pm = PublicToolPageModel
				.getPageInfo(request, sumCount, cp);

		ArrayList<Object> customerInfoList = cdao.searchCustomerInfo(pm, key);
		request.setAttribute("customerInfoList", customerInfoList);
	}
	/**
	 * 查询患者列表
	 * @param request
	 * @param response
	 * @param cp
	 */
	public static void showCustomerInfoList(HttpServletRequest request,
			HttpServletResponse response, String cp) {
		CustomerInfoDAO cdao = new CustomerInfoDAO();
		int sumCount = cdao.getSumCustomerCount();
		PageModel pm = PublicToolPageModel.getPageInfo(request, sumCount, cp);
		ArrayList<Object> customerInfoList = cdao.getPageModel(pm);
		request.setAttribute("customerInfoList", customerInfoList);
	}
}
